package com.zhejiangzhengyuan.municipal_common.utils.LED;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {

    private static SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    /**
     *  比较日期的大小
     * @param beginTime
     * @param endTime
     * @return
     * @throws ParseException
     */
    public static boolean CompareTime(String beginTime, String endTime) throws ParseException {
        Date sd1 = df.parse(beginTime);
        Date sd2 = df.parse(endTime);
        return sd1.before(sd2);
    }


    /**
     *
     *  得到当前时间
     *
     * @return
     */
    public static String GetCurrentTime() {
        return df.format(new Date());
    }


    public static void main(String[] args) throws ParseException {
        String beginTime1 = new String("2017-06-09 10:22:22");
        String endTime1 = new String("2017-06-09 10:22:23");

        boolean cc = DateUtils.CompareTime(beginTime1, endTime1);
        System.out.println(cc);
    }
}
